package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Scanner;

public class Test2 {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("note.txt");
        Scanner scan = new Scanner(System.in);
        OutputStreamWriter osw = new OutputStreamWriter(fos);
        String s;
        System.out.println("程序开始");
        while (true){
            s=scan.nextLine();
            if ("exit".equalsIgnoreCase(s)){
                break;
            }
            osw.write(s);
        }
        System.out.println("程序退出");
        osw.close();
    }
}
